home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 8 / FM Towns Free Software Collection 8.iso / t_os / artemis / artsrc2 / ghvline.asm < prev    next >
Assembly Source File  |  1994-06-01  |  17KB  |  951 lines

  1. ;    私製ライブラリ・グラフィック篇
  2. ;    (c) MATSUUCHI Ryosuke in Dec,1992
  3. ;
  4. ;    ghvline.asm
  5. ;
  6. ;    1992. 7. 9(Thu)
  7. ;    1992. 7.16(Thu)
  8. ;    1992. 8. 2(Sun)
  9. ;    1992.12.28(Sun)
  10.  
  11.         public    ghline,gvline,_ghline,_gvline
  12.         extrn    _gwrtreg:near
  13.         extrn    __AddVramBase_edi    :near
  14.         extrn    __SetVramSeg        :near
  15.         extrn    __AddVramBase_ebx    :near
  16.         extrn    __AddVramBase_esi    :near
  17.         
  18.         include    grplib.inc
  19.         
  20.         assume    cs:cseg, ds:dseg
  21.  
  22.  
  23.  
  24. dseg segment dword 'DATA'
  25.  
  26.         align 4
  27.  
  28. logop        dd    0
  29.  
  30. collist        dd    000000000h
  31.         dd    011111111h
  32.         dd    022222222h
  33.         dd    033333333h
  34.         dd    044444444h
  35.         dd    055555555h
  36.         dd    066666666h
  37.         dd    077777777h
  38.         dd    088888888h
  39.         dd    099999999h
  40.         dd    0aaaaaaaah
  41.         dd    0bbbbbbbbh
  42.         dd    0cccccccch
  43.         dd    0ddddddddh
  44.         dd    0eeeeeeeeh
  45.         dd    0ffffffffh
  46.  
  47. Lmaskpat    dd    0ffffffffh
  48.         dd    0fffffff0h
  49.         dd    0ffffff00h
  50.         dd    0fffff000h
  51.         dd    0ffff0000h
  52.         dd    0fff00000h
  53.         dd    0ff000000h
  54.         dd    0f0000000h
  55.         dd    000000000h
  56.  
  57. Rmaskpat    dd    00000000fh
  58.         dd    0000000ffh
  59.         dd    000000fffh
  60.         dd    00000ffffh
  61.         dd    0000fffffh
  62.         dd    000ffffffh
  63.         dd    00fffffffh
  64.         dd    0ffffffffh
  65.  
  66. vmask        dd    00000000fh
  67.         dd    0000000f0h
  68.         dd    000000f00h
  69.         dd    00000f000h
  70.         dd    0000f0000h
  71.         dd    000f00000h
  72.         dd    00f000000h
  73.         dd    0f0000000h
  74.  
  75. dseg ends
  76.  
  77.  
  78.  
  79. cseg segment dword 'CODE'
  80.  
  81. ;---------------------------------------------------------------
  82. ;    gvline : 垂直直線の描画
  83. ;        in  eax:x
  84. ;            ebx:y1
  85. ;            ecx:y2
  86. ;            edx:col
  87. ;            esi:logop
  88. ;
  89. ;    void gvline(int x, int y1,int y2,int col, int logop);
  90. ;---------------------------------------------------------------
  91.  
  92.         align 4
  93.  
  94. gvline        proc near
  95.         push    ebx
  96.         push    esi
  97.         push    edi
  98.         pushfd
  99.         mov    eax,[esp+16+4]        ;x
  100.         mov    ebx,[esp+16+8]        ;y1
  101.         mov    ecx,[esp+16+12]        ;y2
  102.         mov    edx,[esp+16+16]        ;col
  103.         mov    esi,[esp+16+20]        ;logop
  104.         call    _gvline
  105.         popfd
  106.         pop    edi
  107.         pop    esi
  108.         pop    ebx
  109.         ret
  110. gvline        endp
  111.  
  112.  
  113.  
  114.         align 4
  115.  
  116. _gvline        proc near
  117.         pushad
  118.         push    es
  119.         mov    edi,[_nowscrmod]
  120.         cmp    di,2            ;di の値により分岐
  121.         jle    #end
  122.         cmp    di,4
  123.         jg    #1
  124.         call    gvline16
  125.         jmp    #end
  126. #1:        cmp    di,8
  127.         jg    #2
  128.         call    gvline32a
  129.         jmp    #end
  130. #2:        cmp    di,11
  131.         jg    #3
  132.         call    gvline32b
  133.         jmp    #end
  134. #3:        cmp    di,14
  135.         jg    #4
  136.         call    gvline256
  137.         jmp    #end
  138. #4:        cmp    di,18
  139.         jg    #end
  140.         call    gvline32c
  141. #end:        pop    es
  142.         popad
  143.         ret
  144. _gvline        endp
  145.  
  146.  
  147.  
  148.  
  149.  
  150. ;● VLINE のサブルーチン (16色 VLINE)
  151. ;----------------------------------------------------------------------------
  152.  
  153.  
  154. gvline16    proc near
  155.         mov    [logop],esi        ;[logop]←logop
  156.         cmp    ebx,ecx            ;ebx←min(y1,y2)
  157.         jc    #0            ;ecx←max(y1,y2)
  158.         xchg    ebx,ecx
  159. #0:        or    esi,esi            ;演算指定が NORMAL でないなら
  160.         jnz    #notNORMALmode        ;分岐
  161.     ;
  162.     ;--- 演算指定が NORMAL の場合
  163.     ;
  164.     ;edi ← アドレス
  165.         mov    esi,eax
  166.         and    esi,0fffffff8h
  167.         shr    esi,1
  168.         mov    edi,ebx
  169.         shl    edi,9
  170.         add    edi,esi
  171.         call    __AddVramBase_edi
  172.     ;割り込みの禁止
  173.         cli
  174.     ;esi ← マスクパターン(どの4ビットを有効にするか)
  175.         mov    esi,eax
  176.         and    esi,7
  177.         mov    esi,[vmask+esi*4]
  178.     ;描画処理
  179.         call    __SetVramSeg        ;es ← VRAM セレクタ
  180.         sub    ecx,ebx            ;ecx ← 縦方向の長さ
  181.         inc    ecx
  182.         mov    eax,[collist+edx*4]    ;eax ← カラーデータ
  183.         and    eax,esi
  184.         not    esi            ;マスクビット反転
  185.         mov    ebx,512            ;ebx ← アドレス増加分
  186.         ;---- まず、 12 dot づつまとめて描画する
  187.         sub    ecx,12
  188.         jl    #200
  189.             #201:
  190.                 rept 4
  191.                  mov    edx,es:[edi]
  192.                  and    edx,esi
  193.                  or    edx,eax
  194.                  mov    es:[edi],edx
  195.                  mov    edx,es:[edi+ebx]
  196.                  and    edx,esi
  197.                  or    edx,eax
  198.                  mov    es:[edi+ebx],edx
  199.                  mov    edx,es:[edi+ebx*2]
  200.                  and    edx,esi
  201.                  or    edx,eax
  202.                  mov    es:[edi+ebx*2],edx
  203.                  lea    edi,[edi+ebx*2]      ;edi ← edi + ebx*3
  204.                  add    edi,ebx
  205.                 endm
  206.                 sub    ecx,12
  207.             jge    #201
  208.         #200:
  209.         add    ecx,12
  210.         ;---- 残りを描画する(現在 ecx は 11 以下)
  211.         or    ecx,ecx
  212.         jz    #202
  213.             rept 4
  214.              mov    edx,es:[edi]
  215.              and    edx,esi
  216.              or    edx,eax
  217.              mov    es:[edi],edx
  218.              dec    ecx
  219.              jz    #202
  220.              mov    edx,es:[edi+ebx]
  221.              and    edx,esi
  222.              or    edx,eax
  223.              mov    es:[edi+ebx],edx
  224.              dec    ecx
  225.              jz    #202
  226.              mov    edx,es:[edi+ebx*2]
  227.              and    edx,esi
  228.              or    edx,eax
  229.              mov    es:[edi+ebx*2],edx
  230.              dec    ecx
  231.              jz    #202
  232.              lea    edi,[edi+ebx*2]      ;edi ← edi + ebx*3
  233.              add    edi,ebx
  234.             endm
  235.         #202:
  236.     ;割り込みの許可
  237.         sti
  238.         jmp    #end
  239.     ;
  240.     ;--- 演算指定が XOR の場合
  241.     ;
  242. #notNORMALmode:
  243.     ;edi ← アドレス
  244.         mov    esi,eax
  245.         and    esi,0fffffff8h
  246.         shr    esi,1
  247.         mov    edi,ebx
  248.         shl    edi,9
  249.         add    edi,esi
  250.         call    __AddVramBase_edi
  251.     ;eax ← カラーデータ & マスク
  252.         mov    esi,eax            ;esi ← マスクパターン
  253.         and    esi,7
  254.         mov    esi,[vmask+esi*4]
  255.         mov    eax,[collist+edx*4]    ;eax ← カラーデータ
  256.         and    eax,esi
  257.     ;描画処理
  258.         call    __SetVramSeg        ;es ← vram セレクタ
  259.         sub    ecx,ebx            ;ecx ← 縦方向の長さ
  260.         inc    ecx
  261.         mov    ebx,512            ;ebx ← アドレス増分
  262.         lea    esi,[ebx+ebx*2]        ;esi ← 3 回ごとのアドレス増分
  263.         ;---- まず、12 dot ずつまとめて描画する
  264.         sub    ecx,12
  265.         jl    #102
  266.             #101:
  267.                 rept 4
  268.                  xor    es:[edi      ],eax
  269.                  xor    es:[edi+ebx  ],eax
  270.                  xor    es:[edi+ebx*2],eax
  271.                  add    edi,esi
  272.                 endm
  273.                 sub    ecx,12
  274.             jge    #101
  275.         #102:
  276.         add    ecx,12
  277.         ;---- のこりを描画する
  278.         or    ecx,ecx
  279.         jz    #203
  280.             rept 4
  281.              xor    es:[edi],eax
  282.              dec    ecx
  283.              jz    #203
  284.              xor    es:[edi+ebx],eax
  285.              dec    ecx
  286.              jz    #203
  287.              xor    es:[edi+ebx*2],eax
  288.              dec    ecx
  289.              jz    #203
  290.              add    edi,esi
  291.             endm
  292.         #203:
  293.     ;
  294.     ;おわり
  295.     ;
  296. #end:
  297.         ret
  298. gvline16    endp
  299.  
  300.  
  301. ;● VLINE のサブルーチン (3万色 VLINE [256*512ドットモード])
  302. ;----------------------------------------------------------------------------
  303.  
  304.  
  305. gvline32a    proc near
  306.         cmp    ebx,ecx            ;ebx←min(y1,y2)
  307.         jc    #1            ;ecx←max(y1,y2)
  308.             xchg    ebx,ecx
  309.         #1:
  310.     ;es:edi ← アドレス
  311.         mov    edi,ebx
  312.         shl    edi,9
  313.         add    edi,eax
  314.         add    edi,eax
  315.         call    __AddVramBase_edi
  316.         call    __SetVramSeg
  317.     ;描画の準備
  318.         mov    ax,dx        ;ax ← カラーデータ
  319.         and    ax,7fffh
  320.         sub    ecx,ebx        ;ecx ← 長さ
  321.         inc    ecx
  322.         mov    ebx,512        ;ebx ← アドレスの増分
  323.         lea    edx,[ebx+ebx*2]    ;edx ← アドレスの増分(3ライン分)
  324.     ;描画
  325.         call    gvline32_sub
  326.     ;おわり
  327.         ret
  328. gvline32a    endp
  329.  
  330.  
  331. ;● VLINE のサブルーチン (3万色 VLINE [512*256ドットモード])
  332. ;----------------------------------------------------------------------------
  333.  
  334.  
  335. gvline32b    proc near
  336.         cmp    ebx,ecx            ;ebx←min(y1,y2)
  337.         jc    #1            ;ecx←max(y1,y2)
  338.             xchg    ebx,ecx
  339.         #1:
  340.     ;es:edi ← アドレス
  341.         mov    edi,ebx
  342.         shl    edi,10
  343.         add    edi,eax
  344.         add    edi,eax
  345.         call    __AddVramBase_edi
  346.         call    __SetVramSeg
  347.     ;描画の準備
  348.         mov    ax,dx        ;ax ← カラーデータ
  349.         and    ax,7fffh
  350.         sub    ecx,ebx        ;ecx ← 長さ
  351.         inc    ecx
  352.         mov    ebx,1024    ;ebx ← アドレスの増分
  353.         lea    edx,[ebx+ebx*2]    ;edx ← アドレスの増分(3ライン分)
  354.     ;描画
  355.         call    gvline32_sub
  356.     ;おわり
  357.         ret
  358.         ret
  359. gvline32b    endp
  360.  
  361.  
  362. ;● VLINE のサブルーチン (256色 VLINE)
  363. ;----------------------------------------------------------------------------
  364.  
  365.  
  366. gvline256    proc
  367.         ;★まだ作ってないよーん
  368.         ret
  369. gvline256    endp
  370.  
  371.  
  372. ;● VLINE のサブルーチン (3万色 VLINE [512*512ドットモード])
  373. ;----------------------------------------------------------------------------
  374.  
  375.  
  376. gvline32c    proc
  377.         cmp    ebx,ecx            ;ebx←min(y1,y2)
  378.         jc    #1            ;ecx←max(y1,y2)
  379.             xchg    ebx,ecx
  380.         #1:
  381.     ;es:edi ← アドレス
  382.         mov    edi,ebx
  383.         shl    edi,10
  384.         add    edi,eax
  385.         add    edi,eax
  386.         call    __AddVramBase_edi
  387.         call    __SetVramSeg
  388.     ;描画の準備
  389.         mov    ax,dx        ;ax ← カラーデータ
  390.         and    ax,7fffh
  391.         sub    ecx,ebx        ;ecx ← 長さ
  392.         inc    ecx
  393.         mov    ebx,1024    ;ebx ← アドレスの増分
  394.         lea    edx,[ebx+ebx*2]    ;edx ← アドレスの増分(3ライン分)
  395.     ;描画
  396.         call    gvline32_sub
  397.     ;おわり
  398.         ret
  399. gvline32c    endp
  400.  
  401.  
  402. ;● 3万色 VLINE のサブルーチン
  403. ;----------------------------------------------------------------------------
  404.  
  405.  
  406.         align 4
  407.  
  408. gvline32_sub    proc near
  409.         ;
  410.         ;3万色モードの縦ライン・ 実際の描画を行うサブルーチン
  411.         ;
  412.         ;    in  es:edi  アドレス
  413.         ;        ecx     長さ
  414.         ;        ax      カラーデータ
  415.         ;        ebx     1ライン分のアドレス増分
  416.         ;        edx     3ライン分のアドレス増分
  417.         ;        esi     演算指定
  418.         ;
  419.         cmp    esi,0
  420.         jnz    #1
  421.  
  422.             ;---- NORMAL drawing
  423.             sub    ecx,12
  424.             jl    #4
  425.                 #3:
  426.                     rept 4
  427.                      mov    es:[edi],ax
  428.                      mov    es:[edi+ebx],ax
  429.                      mov    es:[edi+ebx*2],ax
  430.                      add    edi,edx
  431.                     endm
  432.                     sub    ecx,12
  433.                 jge    #3
  434.             #4:
  435.             add    ecx,12
  436.             je    #5
  437.                 rept 4
  438.                  mov    es:[edi],ax
  439.                  dec    ecx
  440.                  jz    #5
  441.                  mov    es:[edi+ebx],ax
  442.                  dec    ecx
  443.                  jz    #5
  444.                  mov    es:[edi+ebx*2],ax
  445.                  dec    ecx
  446.                  jz    #5
  447.                  add    edi,edx
  448.                 endm
  449.             #5:
  450.             jmp    #2
  451.         #1:
  452.  
  453.             ;---- XOR drawing
  454.             sub    ecx,12
  455.             jl    #7
  456.                 #8:
  457.                     rept 4
  458.                      xor    es:[edi],ax
  459.                      xor    es:[edi+ebx],ax
  460.                      xor    es:[edi+ebx*2],ax
  461.                      add    edi,edx
  462.                     endm
  463.                     sub    ecx,12
  464.                 jge    #8
  465.             #7:
  466.             add    ecx,12
  467.             je    #9
  468.                 rept 4
  469.                  xor    es:[edi],ax
  470.                  dec    ecx
  471.                  jz    #9
  472.                  xor    es:[edi+ebx],ax
  473.                  dec    ecx
  474.                  jz    #9
  475.                  xor    es:[edi+ebx*2],ax
  476.                  dec    ecx
  477.                  jz    #9
  478.                  add    edi,edx
  479.                 endm
  480.             #9:
  481.         #2:
  482.         ret
  483. gvline32_sub    endp
  484.  
  485.  
  486.  
  487. ;---------------------------------------------------------------
  488. ;    ghline : 水平直線の描画
  489. ;        in  eax:x1
  490. ;            ebx:x2
  491. ;            ecx:y
  492. ;            edx:col
  493. ;            esi:logop
  494. ;
  495. ;    void ghline(int x1,int x2,int y1,int col,int logop);
  496. ;---------------------------------------------------------------
  497.  
  498.  
  499.  
  500.         align 4
  501.  
  502. ghline        proc near
  503.         push    ebx
  504.         push    edi
  505.         push    esi
  506.         pushfd
  507.         mov    eax,[esp+16+4]        ;x1
  508.         mov    ebx,[esp+16+8]        ;x2
  509.         mov    ecx,[esp+16+12]        ;y
  510.         mov    edx,[esp+16+16]        ;col
  511.         mov    esi,[esp+16+20]        ;logop
  512.         call    _ghline
  513.         popfd
  514.         pop    esi
  515.         pop    edi
  516.         pop    ebx
  517.         ret
  518. ghline        endp
  519.  
  520.  
  521.  
  522.         align    4
  523.  
  524. _ghline        proc near
  525.         pushad
  526.         push    es
  527.         cmp    eax,ebx            ;eaxに左端,ebxに右端
  528.         jb    #0
  529.         xchg    eax,ebx
  530. #0:        mov    edi,[_nowscrmod]    ;画面モードにより分岐
  531.         cmp    di,2
  532.         jle    #end
  533.         cmp    di,4
  534.         jg    #1
  535.         call    ghline16
  536.         jmp    #end
  537. #1:        cmp    di,8
  538.         jg    #2
  539.         call    ghline32a
  540.         jmp    #end
  541. #2:        cmp    di,11
  542.         jg    #3
  543.         call    ghline32b
  544.         jmp    #end
  545. #3:        cmp    di,14
  546.         jg    #4
  547.         call    ghline256
  548.         jmp    #end
  549. #4:        cmp    di,18
  550.         jg    #end
  551.         call    ghline32c
  552. #end:        pop    es
  553.         popad
  554.         ret
  555. _ghline        endp
  556.  
  557.  
  558.  
  559.  
  560.  
  561. ;● HLINE のサブルーチン (16色モード)
  562. ;----------------------------------------------------------------------------
  563.  
  564.  
  565. ghline16    proc near
  566.         pushad
  567.         ;
  568.         mov    [logop],esi
  569.         cmp    eax,ebx
  570.         jb    #0
  571.         xchg    eax,ebx
  572. #0:        mov    esi,eax            ;x1,x2 が同じ dword 内に        
  573.         and    esi,0fffffff8h        ;あるかどうか調べる
  574.         mov    edi,ebx
  575.         and    edi,0fffffff8h
  576.         cmp    esi,edi
  577.         jnz    #1
  578.         ;
  579.         ;    //// x1,x2 が同じdword内にある場合の処理
  580.         ;
  581.         shl    ecx,9            ;ecx に VRAM のアドレスを入れる
  582.         mov    esi,eax
  583.         and    esi,0fffffff8h
  584.         shr    esi,1
  585.         add    esi,ecx
  586.         call    __AddVramBase_esi
  587.         mov    ecx,esi
  588.         mov    edi,eax            ;esi にマスクパターンを入れる
  589.         and    edi,000000007h
  590.         mov    esi,[Lmaskpat+edi*4]
  591.         mov    edi,ebx
  592.         and    edi,000000007h
  593.         and    esi,[Rmaskpat+edi*4]
  594.         mov    edx,[collist+edx*4]    ;edx にカラーデータを入れる
  595.         and    edx,esi
  596.         mov    eax,[logop]        ;eax に演算指定を入れる
  597.         push    es            ;es 保存
  598.         call    __SetVramSeg        ;es に VRAM のセレクタを入れる
  599.         or    eax,eax            ;演算指定により分岐する
  600.         jnz    #2
  601.         mov    eax,es:[ecx]
  602.         not    esi
  603.         and    eax,esi
  604.         or    eax,edx
  605.         mov    es:[ecx],eax
  606.         jmp    #4
  607. #2:        xor    es:[ecx],edx
  608. #4:        pop    es            ;es 復帰
  609.         jmp    #end
  610. #1:        ;
  611.         ;    //// x1,x2が違うdword 内にある時の処理
  612.         ;
  613.     ;es←VRAMセレクタ
  614.         call    __SetVramSeg
  615.     ;ecx←アドレス
  616.         shl    ecx,9
  617.         mov    esi,eax
  618.         and    esi,0fffffff8h
  619.         shr    esi,1
  620.         add    esi,ecx
  621.         call    __AddVramBase_esi
  622.         mov    ecx,esi
  623.     ;x1 が dword 境界じゃない(x1%8!=0) 時、左端の処理
  624.         mov    esi,eax
  625.         and    esi,7h
  626.         jz    #100
  627.             mov    esi,[Lmaskpat+esi*4]    ;esi:マスクパターン
  628.             mov    edi,[collist+edx*4]    ;edi:カラーデータ
  629.             and    edi,esi
  630.             push    ebx            ;ebx(x2)保存
  631.             mov    ebx,[logop]        ;ebx:演算指定
  632.             or    ebx,ebx
  633.             jnz    #101
  634.                 mov    ebx,es:[ecx]    ;PSET演算
  635.                 not    esi
  636.                 and    ebx,esi
  637.                 or    ebx,edi
  638.                 mov    es:[ecx],ebx
  639.                 jmp    #102
  640.             #101:
  641.                 xor    es:[ecx],edi    ;XOR演算
  642.             #102:
  643.             pop    ebx            ;ebx(x2)復帰
  644.             add    ecx,4            ;アドレス補正
  645.             and    eax,0fffffff8h        ;x1 補正
  646.             add    eax,8
  647.         #100:
  648.  
  649.     ;メイン処理
  650.     ;    reg    eax:左端座標
  651.     ;        ebx:右端座標
  652.     ;        ecx:アドレス
  653.     ;        edx:カラーコード
  654.     ;        [logop]:演算指定
  655.  
  656.         mov    esi,[logop]
  657.         or    esi,esi
  658.         jnz    #201
  659.             ;PSET 演算 --- stosd のために eax,es,edi,ecxを設定
  660.             push    eax
  661.             push    ecx
  662.             mov    edi,ecx            ;edi ← アドレス
  663.             mov    ecx,ebx            ;ecx ← 繰り返し回数
  664.             inc    ecx
  665.             sub    ecx,eax
  666.             shr    ecx,3
  667.             mov    eax,[collist+edx*4]    ;eax ← カラーデータ
  668.             mov    esi,ecx            ;繰り返し回数の保存
  669.             cld
  670.             rep stosd
  671.             pop    ecx
  672.             pop    eax
  673.             mov    ecx,edi            ;アドレスの更新
  674.             lea    eax,[esi*8+eax]        ;x1 の更新
  675.             jmp    #202
  676.         #201:    ;XOR 演算 --- loop 命令のために ecx を設定
  677.             push    ecx
  678.             mov    edi,ecx            ;edi←アドレス
  679.             mov    ecx,ebx            ;ecx←繰り返し回数
  680.             inc    ecx
  681.             sub    ecx,eax
  682.             shr    ecx,3
  683.             or    ecx,ecx
  684.             jz    #203
  685.                 mov esi,[collist+edx*4]    ;esi:カラーデータ
  686.                 lea    eax,[ecx*8+eax]    ;x1 の更新
  687.                 #205:
  688.                     xor    es:[edi],esi
  689.                     add    edi,4
  690.                 loop #205
  691.             #203:
  692.             pop    ecx
  693.             mov    ecx,edi            ;アドレスの更新
  694.         #202:
  695.     
  696.     ;右端の処理
  697.     
  698.         cmp    eax,ebx
  699.         jg    #301
  700.             mov    esi,ebx            ;esi←マスクパターン
  701.             and    esi,7
  702.             mov    esi,[Rmaskpat+esi*4]
  703.             mov    edi,[collist+edx*4]    ;edi←カラーデータ
  704.             and    edi,esi
  705.             mov    eax,[logop]        ;eax:logop
  706.             or    eax,eax
  707.             jnz    #302
  708.                 mov    eax,es:[ecx]    ;PSET演算の時
  709.                 not    esi
  710.                 and    eax,esi
  711.                 or    eax,edi
  712.                 mov    es:[ecx],eax
  713.                 jmp    #303
  714.             #302:
  715.                 xor    es:[ecx],edi    ;XOR演算の時
  716.             #303:
  717.         #301:
  718. #end:
  719.         popad
  720.         ret
  721. ghline16    endp
  722.  
  723.  
  724. ;● HLINE のサブルーチン (3万色モード [256*512ドット])
  725. ;----------------------------------------------------------------------------
  726.  
  727.  
  728. ghline32a    proc near
  729.     ;es:edi ← アドレス
  730.         mov    edi,ecx
  731.         shl    edi,9
  732.         add    edi,eax
  733.         add    edi,eax
  734.         call    __AddVramBase_edi
  735.         call    __SetVramSeg
  736.     ;描画
  737.         sub    ebx,eax        ;ecx ← 長さ
  738.         inc    ebx
  739.         mov    ecx,ebx
  740.         mov    eax,edx        ;eax ← カラーデータ
  741.         and    eax,7fffh
  742.         or    esi,esi        ;演算指定により分岐
  743.         jnz    #1
  744.             ;---- NORMAL
  745.             rep stosw
  746.             jmp    #2
  747.         #1:    ;---- XOR
  748.             sub    ecx,16
  749.             jl    #3
  750.                 #4:
  751.                     xor    es:[edi   ],ax
  752.                     xor    es:[edi+ 2],ax
  753.                     xor    es:[edi+ 4],ax
  754.                     xor    es:[edi+ 6],ax
  755.                     xor    es:[edi+ 8],ax
  756.                     xor    es:[edi+10],ax
  757.                     xor    es:[edi+12],ax
  758.                     xor    es:[edi+14],ax
  759.                     xor    es:[edi+16],ax
  760.                     xor    es:[edi+18],ax
  761.                     xor    es:[edi+20],ax
  762.                     xor    es:[edi+22],ax
  763.                     xor    es:[edi+24],ax
  764.                     xor    es:[edi+26],ax
  765.                     xor    es:[edi+28],ax
  766.                     xor    es:[edi+30],ax
  767.                     add    edi,32
  768.                     sub    ecx,16
  769.                 jge    #4
  770.             #3:
  771.             add    ecx,16
  772.             jz    #6
  773.                 rept 4
  774.                  xor    es:[edi],ax
  775.                  dec    ecx
  776.                  jz    #6
  777.                  xor    es:[edi+2],ax
  778.                  dec    ecx
  779.                  jz    #6
  780.                  xor    es:[edi+4],ax
  781.                  dec    ecx
  782.                  jz    #6
  783.                  xor    es:[edi+6],ax
  784.                  dec    ecx
  785.                  jz    #6
  786.                  add    edi,8
  787.                 endm
  788.             #6:
  789.         #2:
  790.     ;おわり
  791.         ret
  792. ghline32a    endp
  793.  
  794.  
  795. ;● HLINE のサブルーチン (3万色モード [512*256ドット])
  796. ;----------------------------------------------------------------------------
  797.  
  798.  
  799. ghline32b    proc near
  800.     ;es:edi ← アドレス
  801.         mov    edi,ecx
  802.         shl    edi,10
  803.         add    edi,eax
  804.         add    edi,eax
  805.         call    __AddVramBase_edi
  806.         call    __SetVramSeg
  807.     ;描画
  808.         sub    ebx,eax        ;ecx ← 長さ
  809.         inc    ebx
  810.         mov    ecx,ebx
  811.         mov    eax,edx        ;eax ← カラーデータ
  812.         and    eax,7fffh
  813.         or    esi,esi        ;演算指定により分岐
  814.         jnz    #1
  815.             ;---- NORMAL
  816.             rep stosw
  817.             jmp    #2
  818.         #1:    ;---- XOR
  819.             sub    ecx,16
  820.             jl    #3
  821.                 #4:
  822.                     xor    es:[edi   ],ax
  823.                     xor    es:[edi+ 2],ax
  824.                     xor    es:[edi+ 4],ax
  825.                     xor    es:[edi+ 6],ax
  826.                     xor    es:[edi+ 8],ax
  827.                     xor    es:[edi+10],ax
  828.                     xor    es:[edi+12],ax
  829.                     xor    es:[edi+14],ax
  830.                     xor    es:[edi+16],ax
  831.                     xor    es:[edi+18],ax
  832.                     xor    es:[edi+20],ax
  833.                     xor    es:[edi+22],ax
  834.                     xor    es:[edi+24],ax
  835.                     xor    es:[edi+26],ax
  836.                     xor    es:[edi+28],ax
  837.                     xor    es:[edi+30],ax
  838.                     add    edi,32
  839.                     sub    ecx,16
  840.                 jge    #4
  841.             #3:
  842.             add    ecx,16
  843.             jz    #6
  844.                 rept 4
  845.                  xor    es:[edi],ax
  846.                  dec    ecx
  847.                  jz    #6
  848.                  xor    es:[edi+2],ax
  849.                  dec    ecx
  850.                  jz    #6
  851.                  xor    es:[edi+4],ax
  852.                  dec    ecx
  853.                  jz    #6
  854.                  xor    es:[edi+6],ax
  855.                  dec    ecx
  856.                  jz    #6
  857.                  add    edi,8
  858.                 endm
  859.             #6:
  860.         #2:
  861.     ;おわり
  862.         ret
  863. ghline32b    endp
  864.  
  865.  
  866. ;● HLINE のサブルーチン (256色モード)
  867. ;----------------------------------------------------------------------------
  868.  
  869.  
  870. ghline256    proc
  871.         ;★まだ作ってないよーん
  872.         ret
  873. ghline256    endp
  874.  
  875.  
  876. ;● HLINE のサブルーチン (3万色モード [512*512ドット])
  877. ;----------------------------------------------------------------------------
  878.  
  879.  
  880. ghline32c    proc
  881.     ;es:edi ← アドレス
  882.         mov    edi,ecx
  883.         shl    edi,10
  884.         add    edi,eax
  885.         add    edi,eax
  886.         call    __AddVramBase_edi
  887.         call    __SetVramSeg
  888.     ;描画
  889.         sub    ebx,eax        ;ecx ← 長さ
  890.         inc    ebx
  891.         mov    ecx,ebx
  892.         mov    eax,edx        ;eax ← カラーデータ
  893.         and    eax,7fffh
  894.         or    esi,esi        ;演算指定により分岐
  895.         jnz    #1
  896.             ;---- NORMAL
  897.             rep stosw
  898.             jmp    #2
  899.         #1:    ;---- XOR
  900.             sub    ecx,16
  901.             jl    #3
  902.                 #4:
  903.                     xor    es:[edi   ],ax
  904.                     xor    es:[edi+ 2],ax
  905.                     xor    es:[edi+ 4],ax
  906.                     xor    es:[edi+ 6],ax
  907.                     xor    es:[edi+ 8],ax
  908.                     xor    es:[edi+10],ax
  909.                     xor    es:[edi+12],ax
  910.                     xor    es:[edi+14],ax
  911.                     xor    es:[edi+16],ax
  912.                     xor    es:[edi+18],ax
  913.                     xor    es:[edi+20],ax
  914.                     xor    es:[edi+22],ax
  915.                     xor    es:[edi+24],ax
  916.                     xor    es:[edi+26],ax
  917.                     xor    es:[edi+28],ax
  918.                     xor    es:[edi+30],ax
  919.                     add    edi,32
  920.                     sub    ecx,16
  921.                 jge    #4
  922.             #3:
  923.             add    ecx,16
  924.             jz    #6
  925.                 rept 4
  926.                  xor    es:[edi],ax
  927.                  dec    ecx
  928.                  jz    #6
  929.                  xor    es:[edi+2],ax
  930.                  dec    ecx
  931.                  jz    #6
  932.                  xor    es:[edi+4],ax
  933.                  dec    ecx
  934.                  jz    #6
  935.                  xor    es:[edi+6],ax
  936.                  dec    ecx
  937.                  jz    #6
  938.                  add    edi,8
  939.                 endm
  940.             #6:
  941.         #2:
  942.     ;おわり
  943.         ret
  944. ghline32c    endp
  945.  
  946.  
  947.  
  948. cseg ends
  949.  
  950. end
  951.